package com.infusionesuci.utils;

import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.widget.Toast;

public class Geolocalizacion implements LocationListener {

	private String proveedor="";
	private LocationManager locationManager;
	private Double []  coordenadas = new Double[2]; 
	
	public Geolocalizacion(LocationManager locationManager){
		this.locationManager=locationManager;
		this.proveedor = LocationManager.NETWORK_PROVIDER;
	}

	public void onLocationChanged(Location location) {
		// TODO Auto-generated method stub
		if(location!=null){
			coordenadas[0]=location.getLatitude();
			coordenadas[1]=location.getLongitude();
			this.locationManager.removeUpdates(this);
		}
	}

	public void onProviderDisabled(String provider) {
		// TODO Auto-generated method stub
		
	}

	public void onProviderEnabled(String provider) {
		// TODO Auto-generated method stub
		
	}

	public void onStatusChanged(String provider, int status, Bundle extras) {
		// TODO Auto-generated method stub
		
	}
	
	public Double[] obtenerCoordenadas(){
		return this.coordenadas;
	}
}
